package com.ruoyi.am.utils;




import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class PasswordUtil {

    private static MessageDigest md;
    private static final String key="kai2000922";

    public static String upPassword(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        md=MessageDigest.getInstance("md5");
        byte[] md5_password=md.digest(password.getBytes("utf-8"));

        return Base64.encode(md5_password);
    }

    public static boolean pdIsTrue(String standard_password,String input_password) throws UnsupportedEncodingException, NoSuchAlgorithmException {
        if(standard_password.equals(upPassword(input_password))){
            return true;
        }
        else
            return false;
    }

}
